<template>
  <div>
      <h1>如下会添加人员信息</h1>
      <h2>我的分数为{{mark}}</h2>
      <!-- <h2>{{fangxiang}}----{{sport}}</h2> -->
      <button @click="getAddress">点我给父组件传递信息</button>
      <input type="text" v-model="mingzhi"><button @click="addPerson">添加</button>
      <ul>
          <li v-for="(item,index) in personList" :key="index">{{item}}</li>
      </ul>
      <slot name="slot1"></slot>
      <slot name="slot2"></slot>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
    data() {
        return {
            mingzhi:'',
            address:'广安市人民公园'
        }
    },
    props:['mark'],
    inject:['fangxiang','sports'],
    created(){
       
    },
    methods: {
        addPerson(){
            this.$store.commit('ADD_PERSON',this.mingzhi)
        },
        getAddress(){
            console.log(123)
            this.$emit('getAddress',this.address)
        }
    },
    computed:{
        ...mapState(['personList'])
    }
}
</script>

<style>

</style>